<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">


    <body>

        <ui:composition template="./../templates/templateMain.xhtml">

            <ui:define name="content">
                

                    <!--:growl showDetail="true"/-->

                    <!--p:panel header="Ofertas">
                        <h:outputText value="Páginas Disponíveis:"/>
                    </p:panel-->

                    <p:panel header="Produtos">
                        <h:form>
                            <p:dataTable id="basic" var="p" value="#{backingProduto.listaProdutos}"  paginator="true" rows="15">  
                                <p:column id="modelHeader">  
                                    <f:facet name="header">  
                                        Categoria   
                                    </f:facet>  
                                    <h:outputText value="#{p.categoria}" />  
                                </p:column>  

                                <p:column>  
                                    <f:facet name="header">  
                                        Descrição
                                    </f:facet>  
                                    <h:outputText value="#{p.descricaoProduto}" />  
                                </p:column>  

                                <p:column>  
                                    <f:facet name="header">  
                                        Nome
                                    </f:facet>  
                                    <h:outputText value="#{p.nomeProduto}" />  
                                </p:column>  

                                <p:column>  
                                    <f:facet name="header">  
                                        Preço  
                                    </f:facet>  
                                    <h:outputText value="R$ #{p.precoProduto}" />  
                                </p:column>  

                                <!--p:column>  
                                    <f:facet name="header"/>  
                                    <h:graphicImage value="#{p.caminhoImage}"/>
                                </p:column--> 

                                <p:column>  
                                    <f:facet name="header"/>  
                                    <p:commandButton value="Alterar" action="#{backingProduto.prepararAlterarProduto()}" rendered="#{!backingCliente.admin}"/>  
                                    <p:commandButton value="Comprar" action="#{backingProduto.prepararCompra()}" rendered="#{backingCliente.admin}" />  
                                </p:column>  
                                <p:column>  
                                    <f:facet name="header"/>  
                                    <p:commandButton value="Excluir" action="#{backingProduto.excluirProduto()}" />  
                                </p:column>  

                                <!--p:column>  
                                    <f:facet name="header"/>  
                                    <h:commandButton image="/resources/img/icons/pesquisa.png" />  
                                </p:column> 
                                
                                <p:column>  
                                    <f:facet name="header"/>  
                                    <h:commandButton image="/resources/img/icons/pesquisa.png" />  
                                </p:column--> 
                            </p:dataTable>  
                        </h:form>
                    </p:panel>
               
            </ui:define>


        </ui:composition>

    </body>
</html>
